﻿using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Cofe.Core.Interfaces;

namespace Cofe.Core.Implements
{
    [Export(typeof(ICofeService))]
    [ServicePriority(ServicePriorityAttribute.DefaultPriority_COFE)]
    public class CofePathParserManager : IPathParserManager
    {
        #region Constructor

        public CofePathParserManager()
        {            
        }

        protected CofePathParserManager(IPathParseBehaviorManager behavior)
        {
            _parseBehavior = behavior;    
        }


        #endregion

        #region Methods

        #endregion

        #region Data

        IPathParser[] _pathParsers = null;
        IEntryConstructor _entryConstructor = null;
        IPathParseBehaviorManager _parseBehavior =  null;

        #endregion

        #region Public Properties


        public IPathParseBehaviorManager Behaviors
        {
            get { return _parseBehavior ?? (_parseBehavior = CofeServices.ServiceLocater.FindService<IPathParseBehaviorManager>()); }            
        }

        public IPathParser[] PathParsers
        {
            get { return _pathParsers ?? (_pathParsers = CofeServices.ServiceLocater.FindAllServices<IPathParser>().ToArray()); }
            set { _pathParsers = value; }
        }

        public IEntryConstructor EntryConstructor
        {
            get { return _entryConstructor ?? (_entryConstructor = CofeServices.ServiceLocater.FindService<IEntryConstructor>()); }  
            set { _entryConstructor = value; } 
        }        

        #endregion



    }
}
